﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using WXDba.Entity;
using WXDba.Abstract;
using System.Data.Entity;
namespace WXDba.Factory
{
    /// <summary>
    /// 月饼统计
    /// </summary>
    internal class YueBingOperate : BaseOperate, IYueBing
    {
        public DbSet<YueBing> GetDbSet()
        {
            return Context.YueBings;
        }

        /// <summary>
        /// 添加对象
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Add(YueBing model)
        {
            GetDbSet().Add(model);
            return Save() > 0;
        }
        /// <summary>
        /// 获取喜欢，不喜欢个数
        /// </summary>
        /// <param name="Title"></param>
        /// <returns></returns>
        public int GetCount_Like(string Title, bool IsLike)
        {
            return GetDbSet().Where(q => q.Title == Title && q.IsLike == IsLike).Count();
        }
        /// <summary>
        /// 获取是否吃过，个数
        /// </summary>
        public int GetCount_Eat(string Title, bool IsEat)
        {
            return GetDbSet().Where(q => q.Title == Title && q.IsEat == IsEat).Count();
        }
    }
}
